from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

url = 'https://imooc.com'
driver = webdriver.Chrome(executable_path='/usr/local/bin/chromedriver')
driver.get(url)
sleep(2)

# begin

result1 = driver.find_element(By.ID, 'globalTopBanner')
print("result1", result1)

result2 = driver.find_elements(By.CLASS_NAME, 'remind_warp')
print("result2", result2)

result21 = driver.find_elements(By.CLASS_NAME, 'l')
print("result21", len(result21), result21)

result3 = driver.find_elements(By.TAG_NAME, 'div')
print("result3", len(result3), result3)

result4 = driver.find_elements(By.XPATH, './/*[contains(@class, "l")]')
print("result4", len(result4), result4)

result5 = driver.find_elements(By.LINK_TEXT, '免费课')
print("result5", len(result5), result5)

sleep(2)
driver.quit()
